|
|
|
|
|
|
|
Case vbDataActionAddNew '5
GetAction = "AddNew"
Case vbDataActionUpdate '6
GetAction = "Update"
Case vbDataActionDelete '7
GetAction = "Delete"
Case vbDataActionFind '8
GetAction = "Find"
Case vbDataActionBookmark '9
GetAction = "Bookmark"
Case vbDataActionClose '10
GetAction = "Close"
Case vbDataActionUnload '11
GetAction = "Unload"
End Select
'
End Function |
|
|
|
|
|
|
|
|
Now you need to add one more set of code. Listing 21.47 shows the code you need to enter into the Data1_Validate event. This code checks to see if any of the columns have been altered. If so, an audit log is generated. |
|
|
|
|
|
|
|
|
Listing 21.47. Adding code to the Data1_Validate event. |
|
|
|
|
|
|
|
|
Private Sub Data1_Validate(Action As Integer, Save As Integer)
'
' log any changes
'
Dim ctlTemp As Control
'
MousePointer = vbHourglass
'
' check text boxes for changed data
For Each ctlTemp In Controls
If TypeOf ctlTemp Is TextBox Then
If ctlTemp.DataChanged Then
objLog.WriteLog GetAction(Action), Data1.RecordSource,
ctlTemp.DataField, Data1.Recordset.Fields(ctlTemp.DataField), ctlTemp
End If
End If
Next
'
MousePointer = vbNormal
'
End Sub |
|
|
|
|
|
|
|
|
That's all there is to it. Now save the form as FRMSECTEST.FRM and the project as PRJSECTEST.VBP, and run it. If you log in as USERA, you have very limited access to the data (see Figure 21.13). |
|
|
|
|
|